{{useCss "app-pages/css/main.scss",(["/main.html","/"]) }}
<div class="imgbox">
    <mobile_picwall array-data-key="bus_info.config.home_imgs"></mobile_picwall>
</div>

<div class="logoinfo">
    {{#if bus_info.info.logo_url}}
    <div class="logobox">
        <img bind-src="{{bus_info.info.logo_url}}">
    </div>
    {{/if}}
    <div class="infos {{bus_info.info.logo_url&&'focus'}}">
        <div class="_storename">{{bus_info.info.title}}</div>
    </div>
</div>


<!-- goods -->
<div class="_main_goods">
    {{#each $Cache.main.goods_list}}
    <mobilemaingoods href="goods_details.html?id={{_id}}" src="{{preview_img_url}}?imageView/2/w/330" name="{{goods_name}}" intro="{{intro}}" price="{{price}}"></mobilemaingoods>
    {{/each}}
</div>

<div class="bottom">
    <href to="goods_list.html?id=3">点此查看更多商品</href>
</div>

<xmp type="tag" name="mobile_picwall">
    <div class="picwall">
        <div class="carosule">
            <div class="pic-show">
            {{#if ${array-data-key}.length }}
                {{#each ${array-data-key} }}
                <div style="z-index:{{$Parent.length-$Index}}" class="pic">
                    <href target="_blank" bind-to="{{href||'javascript:void 0'}}">
                        <img bind-src="{{img_url}}?imageView/1/w/500/h/200" />
                    </href>
                </div>
                {{/each}}
            {{#else}}
                <div style="z-index:{{$Parent.length-$Index}}" class="pic">
                    <href target="_blank" bind-to="{{href||'javascript:void 0'}}">
                        <img bind-src="/images/default_bg.jpg" />
                    </href>
                </div>
            {{/if}}
            </div>
        </div>
    </div>
    <script type="text/vm">
        function(vm) {
            var picwall = vm.queryElement({
                className: 'picwall'
            })[0];
            var img = vm.queryElement({
                tagName: "IMG"
            });
            require(["jQuery"], function($) {
                var $picwall = $(picwall);
                var i = 0;
                var w = $picwall.width();
                var h = w * 0.4;
                $picwall.height(h);
                var current_pic;
                var pics = $picwall.find(".pic");
                var len = $(pics).length;
                console.log(len);   
                var timer = setInterval(function _() {
                    $(pics[(i - 1) % len]).stop().fadeOut(1000);
                    $(pics[i % len]).stop().fadeIn(1000);
                    i += 1;
                    return _;
                }(), 5000);
            });
        }
    </script>
</xmp>

<xmp type="tag" name="mobilemaingoods">
    <div class="maingoods">
        <div class="goodsimg">
            <href to="${href}">
                <img bind-src="${src}" />
            </href>
        </div>
        <div class="goodsinfo">
            <div class="infoitem">
                <span class="name">${name}</span>
            </div>
            <div class="infoitem">
                <span class="intro">${intro}</span>
            </div>
            <div class="infoitem">
                <div class="item">
                    <span class="price">￥<label>${price}</label></span>
                </div>
               <div class="item right">
                    {{#if num}}
                        {{#if $Top.loginer}}
                        <button event-click="{{'$Top.$Event.goods_list.add_to_cart'}}">立即购买</button>
                        {{#else}}
                        <href to="sign_in.html?gid={{_id}}" >
                            <button>立即购买</button>
                        </href>
                        {{/if}}
                    {{#else}}
                    <a>
                        <button class="disabled" disabled="true">暂时缺货</sbutton>
                    </a>
                    {{/if}}
                </div>
            </div>
        </div>
    </div>
    <script type="text/vm">
        function(vm) {
            var goodsimg = vm.queryElement({
                className: "goodsimg"
            })[0];
            var goodsobj = vm.queryElement({
                className: "maingoods"
            })[0]
            require(['common','jQuery'], function(jSouper,$) {
                if($('body').width()>600){
                    console.log()
                    $(goodsobj).css({'width':'46%',"margin":".7rem 2%"});
                };
            });
        }
    </script>
</xmp>
